import { Component, OnInit } from '@angular/core';
import { NzMessageService, NzModalRef } from 'ng-zorro-antd';
import { SFSchema } from '@delon/form';
@Component({
  selector: 'app-checking-edit',
  templateUrl: './edit.component.html',
})
export class BusinessCheckingEditComponent implements OnInit {
  i: any = {};
  accountInfo: string = '新增考勤';
  schema: SFSchema = {
    properties: {
      rule: { type: 'string', title: '考勤规则', enum: [
        { value: '排班制', label: '排班制' },
        { value: '坐班制', label: '坐班制' },
        { value: '自由打卡', label: '自由打卡' },
        { value: '弹性工作', label: '弹性工作' }
      ]},
      name: {
        type: 'string',
        title: '考勤人员'
      },
      holiday: { type: 'string', title: '假期类型',
      enum: [
        { value: '事假', label: '事假' },
        { value: '病假', label: '病假' },
        { value: '工伤假', label: '工伤假' },
        { value: '产假', label: '产假' },
        { value: '年假', label: '年假' },
        { value: '旷工', label: '旷工' },
        { value: '迟到', label: '迟到' },
        { value: '其他', label: '其他' }
      ]},
      duration: {
        type: 'string',
        title: '时长'
      },
      documents: {
        type: 'string',
        title: '单据抄送'
      },
      dockPay: {
        type: 'string',
        title: '是否扣薪',
        enum: [
          { value: '是', label: '是' },
          { value: '否', label: '否' }
        ]
      },
      payPproportion: {
        type: 'string',
        title: '扣薪比例'
      },
      note: {
        type: 'string',
        title: '备注'
      }
    },
    required: ['rule', 'name', 'holiday', 'duration', 'dockPay'],
    ui: {
      spanLabelFixed: 80,
      grid: { span: 24 },
    },
  };
  constructor(private modal: NzModalRef, private msgSrv: NzMessageService) {}
  ngOnInit() {
    if(this.i._id) {
      this.accountInfo = '修改考勤'
    }
  }
  save(value: any) {
    // this.msgSrv.success('保存成功');
    this.modal.close(value);
  }
  close() {
    this.modal.destroy();
  }
}
